Optimal. Leaf size=145 \[ -\frac {(3 A-B) \tanh ^{-1}(\sin (c+d x))}{a^3 d}+\frac {2 (36 A-11 B) \tan (c+d x)}{15 a^3 d}-\frac {(A-B) \tan (c+d x)}{5 d (a+a \cos (c+d x))^3}-\frac {(9 A-4 B) \tan (c+d x)}{15 a d (a+a \cos (c+d x))^2}-\frac {(3 A-B) \tan (c+d x)}{d \left (a^3+a^3 \cos (c+d x)\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.31, antiderivative size = 145, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {3057, 2827,
3852, 8, 3855} \begin {gather*} \frac {2 (36 A-11 B) \tan (c+d x)}{15 a^3 d}-\frac {(3 A-B) \tanh ^{-1}(\sin (c+d x))}{a^3 d}-\frac {(3 A-B) \tan (c+d x)}{d \left (a^3 \cos (c+d x)+a^3\right )}-\frac {(9 A-4 B) \tan (c+d x)}{15 a d (a \cos (c+d x)+a)^2}-\frac {(A-B) \tan (c+d x)}{5 d (a \cos (c+d x)+a)^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2827
Rule 3057
Rule 3852
Rule 3855
Rubi steps
\begin {align*} \int \frac {(A+B \cos (c+d x)) \sec ^2(c+d x)}{(a+a \cos (c+d x))^3} \, dx &=-\frac {(A-B) \tan (c+d x)}{5 d (a+a \cos (c+d x))^3}+\frac {\int \frac {(a (6 A-B)-3 a (A-B) \cos (c+d x)) \sec ^2(c+d x)}{(a+a \cos (c+d x))^2} \, dx}{5 a^2}\\ &=-\frac {(A-B) \tan (c+d x)}{5 d (a+a \cos (c+d x))^3}-\frac {(9 A-4 B) \tan (c+d x)}{15 a d (a+a \cos (c+d x))^2}+\frac {\int \frac {\left (a^2 (27 A-7 B)-2 a^2 (9 A-4 B) \cos (c+d x)\right ) \sec ^2(c+d x)}{a+a \cos (c+d x)} \, dx}{15 a^4}\\ &=-\frac {(A-B) \tan (c+d x)}{5 d (a+a \cos (c+d x))^3}-\frac {(9 A-4 B) \tan (c+d x)}{15 a d (a+a \cos (c+d x))^2}-\frac {(3 A-B) \tan (c+d x)}{d \left (a^3+a^3 \cos (c+d x)\right )}+\frac {\int \left (2 a^3 (36 A-11 B)-15 a^3 (3 A-B) \cos (c+d x)\right ) \sec ^2(c+d x) \, dx}{15 a^6}\\ &=-\frac {(A-B) \tan (c+d x)}{5 d (a+a \cos (c+d x))^3}-\frac {(9 A-4 B) \tan (c+d x)}{15 a d (a+a \cos (c+d x))^2}-\frac {(3 A-B) \tan (c+d x)}{d \left (a^3+a^3 \cos (c+d x)\right )}+\frac {(2 (36 A-11 B)) \int \sec ^2(c+d x) \, dx}{15 a^3}-\frac {(3 A-B) \int \sec (c+d x) \, dx}{a^3}\\ &=-\frac {(3 A-B) \tanh ^{-1}(\sin (c+d x))}{a^3 d}-\frac {(A-B) \tan (c+d x)}{5 d (a+a \cos (c+d x))^3}-\frac {(9 A-4 B) \tan (c+d x)}{15 a d (a+a \cos (c+d x))^2}-\frac {(3 A-B) \tan (c+d x)}{d \left (a^3+a^3 \cos (c+d x)\right )}-\frac {(2 (36 A-11 B)) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{15 a^3 d}\\ &=-\frac {(3 A-B) \tanh ^{-1}(\sin (c+d x))}{a^3 d}+\frac {2 (36 A-11 B) \tan (c+d x)}{15 a^3 d}-\frac {(A-B) \tan (c+d x)}{5 d (a+a \cos (c+d x))^3}-\frac {(9 A-4 B) \tan (c+d x)}{15 a d (a+a \cos (c+d x))^2}-\frac {(3 A-B) \tan (c+d x)}{d \left (a^3+a^3 \cos (c+d x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(482\) vs. \(2(145)=290\).
time = 3.18, size = 482, normalized size = 3.32 \begin {gather*} \frac {960 (3 A-B) \cos ^6\left (\frac {1}{2} (c+d x)\right ) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+\cos \left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {c}{2}\right ) \sec (c) \sec (c+d x) \left (-5 (51 A-32 B) \sin \left (\frac {d x}{2}\right )+(567 A-167 B) \sin \left (\frac {3 d x}{2}\right )-600 A \sin \left (c-\frac {d x}{2}\right )+170 B \sin \left (c-\frac {d x}{2}\right )+375 A \sin \left (c+\frac {d x}{2}\right )-170 B \sin \left (c+\frac {d x}{2}\right )-480 A \sin \left (2 c+\frac {d x}{2}\right )+160 B \sin \left (2 c+\frac {d x}{2}\right )-60 A \sin \left (c+\frac {3 d x}{2}\right )+75 B \sin \left (c+\frac {3 d x}{2}\right )+402 A \sin \left (2 c+\frac {3 d x}{2}\right )-167 B \sin \left (2 c+\frac {3 d x}{2}\right )-225 A \sin \left (3 c+\frac {3 d x}{2}\right )+75 B \sin \left (3 c+\frac {3 d x}{2}\right )+315 A \sin \left (c+\frac {5 d x}{2}\right )-95 B \sin \left (c+\frac {5 d x}{2}\right )+30 A \sin \left (2 c+\frac {5 d x}{2}\right )+15 B \sin \left (2 c+\frac {5 d x}{2}\right )+240 A \sin \left (3 c+\frac {5 d x}{2}\right )-95 B \sin \left (3 c+\frac {5 d x}{2}\right )-45 A \sin \left (4 c+\frac {5 d x}{2}\right )+15 B \sin \left (4 c+\frac {5 d x}{2}\right )+72 A \sin \left (2 c+\frac {7 d x}{2}\right )-22 B \sin \left (2 c+\frac {7 d x}{2}\right )+15 A \sin \left (3 c+\frac {7 d x}{2}\right )+57 A \sin \left (4 c+\frac {7 d x}{2}\right )-22 B \sin \left (4 c+\frac {7 d x}{2}\right )\right )}{120 a^3 d (1+\cos (c+d x))^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.24, size = 162, normalized size = 1.12
method | result | size |
derivativedivides | \(\frac {\left (-12 A +4 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {4 A}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+\frac {A \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{5}-\frac {B \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{5}+2 \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) A -\frac {4 \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) B}{3}+17 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-7 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\left (12 A -4 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {4 A}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}}{4 d \,a^{3}}\) | \(162\) |
default | \(\frac {\left (-12 A +4 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {4 A}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+\frac {A \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{5}-\frac {B \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{5}+2 \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) A -\frac {4 \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) B}{3}+17 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-7 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\left (12 A -4 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {4 A}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}}{4 d \,a^{3}}\) | \(162\) |
norman | \(\frac {\frac {\left (A -B \right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{20 d a}+\frac {\left (3 A -2 B \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d a}-\frac {\left (15 A -2 B \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d a}-\frac {\left (25 A -7 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d a}+\frac {\left (42 A -17 B \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{10 d a}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) a^{2}}+\frac {\left (3 A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a^{3} d}-\frac {\left (3 A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a^{3} d}\) | \(216\) |
risch | \(\frac {2 i \left (45 A \,{\mathrm e}^{6 i \left (d x +c \right )}-15 B \,{\mathrm e}^{6 i \left (d x +c \right )}+225 A \,{\mathrm e}^{5 i \left (d x +c \right )}-75 B \,{\mathrm e}^{5 i \left (d x +c \right )}+480 A \,{\mathrm e}^{4 i \left (d x +c \right )}-160 B \,{\mathrm e}^{4 i \left (d x +c \right )}+600 A \,{\mathrm e}^{3 i \left (d x +c \right )}-170 B \,{\mathrm e}^{3 i \left (d x +c \right )}+567 A \,{\mathrm e}^{2 i \left (d x +c \right )}-167 B \,{\mathrm e}^{2 i \left (d x +c \right )}+315 A \,{\mathrm e}^{i \left (d x +c \right )}-95 B \,{\mathrm e}^{i \left (d x +c \right )}+72 A -22 B \right )}{15 d \,a^{3} \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )^{5} \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {3 A \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{a^{3} d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{a^{3} d}+\frac {3 A \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{a^{3} d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{a^{3} d}\) | \(275\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 286 vs.
\(2 (139) = 278\).
time = 0.27, size = 286, normalized size = 1.97 \begin {gather*} \frac {3 \, A {\left (\frac {40 \, \sin \left (d x + c\right )}{{\left (a^{3} - \frac {a^{3} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}} + \frac {\frac {85 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {10 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} + \frac {\sin \left (d x + c\right )^{5}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{5}}}{a^{3}} - \frac {60 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{3}} + \frac {60 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{3}}\right )} - B {\left (\frac {\frac {105 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {20 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} + \frac {3 \, \sin \left (d x + c\right )^{5}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{5}}}{a^{3}} - \frac {60 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{3}} + \frac {60 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{3}}\right )}}{60 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.35, size = 272, normalized size = 1.88 \begin {gather*} -\frac {15 \, {\left ({\left (3 \, A - B\right )} \cos \left (d x + c\right )^{4} + 3 \, {\left (3 \, A - B\right )} \cos \left (d x + c\right )^{3} + 3 \, {\left (3 \, A - B\right )} \cos \left (d x + c\right )^{2} + {\left (3 \, A - B\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 15 \, {\left ({\left (3 \, A - B\right )} \cos \left (d x + c\right )^{4} + 3 \, {\left (3 \, A - B\right )} \cos \left (d x + c\right )^{3} + 3 \, {\left (3 \, A - B\right )} \cos \left (d x + c\right )^{2} + {\left (3 \, A - B\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (2 \, {\left (36 \, A - 11 \, B\right )} \cos \left (d x + c\right )^{3} + 3 \, {\left (57 \, A - 17 \, B\right )} \cos \left (d x + c\right )^{2} + {\left (117 \, A - 32 \, B\right )} \cos \left (d x + c\right ) + 15 \, A\right )} \sin \left (d x + c\right )}{30 \, {\left (a^{3} d \cos \left (d x + c\right )^{4} + 3 \, a^{3} d \cos \left (d x + c\right )^{3} + 3 \, a^{3} d \cos \left (d x + c\right )^{2} + a^{3} d \cos \left (d x + c\right )\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \frac {\int \frac {A \sec ^{2}{\left (c + d x \right )}}{\cos ^{3}{\left (c + d x \right )} + 3 \cos ^{2}{\left (c + d x \right )} + 3 \cos {\left (c + d x \right )} + 1}\, dx + \int \frac {B \cos {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{\cos ^{3}{\left (c + d x \right )} + 3 \cos ^{2}{\left (c + d x \right )} + 3 \cos {\left (c + d x \right )} + 1}\, dx}{a^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.47, size = 190, normalized size = 1.31 \begin {gather*} -\frac {\frac {60 \, {\left (3 \, A - B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a^{3}} - \frac {60 \, {\left (3 \, A - B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a^{3}} + \frac {120 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )} a^{3}} - \frac {3 \, A a^{12} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, B a^{12} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 30 \, A a^{12} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 20 \, B a^{12} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 255 \, A a^{12} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 105 \, B a^{12} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{15}}}{60 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.28, size = 168, normalized size = 1.16 \begin {gather*} \frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (\frac {A-B}{6\,a^3}+\frac {4\,A-2\,B}{12\,a^3}\right )}{d}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {3\,A}{2\,a^3}+\frac {3\,\left (A-B\right )}{4\,a^3}+\frac {4\,A-2\,B}{2\,a^3}\right )}{d}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5\,\left (A-B\right )}{20\,a^3\,d}-\frac {2\,A\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a^3\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-a^3\right )}-\frac {2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (3\,A-B\right )}{a^3\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________